﻿package Interface.WelcomePageClasses
{	
	import Fonts.FranclinGothicDemi;
	import Core.Page;

	import flash.display.Sprite;
	import flash.text.TextField;	
	import flash.text.TextFormat;	

	public class ScrollingLabel extends Sprite
	{
		private var FText:TextField;		
		private var FCover:Sprite;
		private var FPage:Page;
				
		public function ScrollingLabel(AText:String = '', APage:Page = null):void
		{
			var vFont:FranclinGothicDemi = new FranclinGothicDemi();
			var vFormat:TextFormat = new TextFormat(vFont.fontName);
			vFormat.size = 38;			
			vFormat.align = 'center';
			vFormat.color = 0xFFFFFF;
			
			FText = new TextField();			
			FText.width = 270;
			FText.embedFonts = true;
			FText.defaultTextFormat = vFormat;
			FText.selectable = false;			
			FText.text = AText;			
			addChild(FText);
			
			FCover = new Sprite();
			FCover.graphics.beginFill(0xFFFFFF, 0);
			FCover.graphics.drawRect(0, 0, width, height);
			FCover.graphics.endFill();
			FCover.buttonMode = true;
			FCover.useHandCursor = true;
			addChild(FCover);			
			
			FPage = APage;
		}
		
		public function set Text(AText:String):void
		{
			FText.text = AText;
		}
		
		public function set PageLink(APage:Page):void
		{
			FPage = APage;			
		}
		
		public function get PageLink():Page
		{
			return FPage;
		}
	}	
}
